<template>
    <div>
        <div>{{content}}</div>
        <h1>{{name}}</h1>
        <a-button @click="changeName" type="danger">Primary</a-button>
    </div>
</template>
<script>
import { mapState } from 'vuex'
export default {
    data() {
        return {
            content: '我是主页'
        }
    },
    computed: mapState({
        name: state => state.user.name
    }),
    methods: {
        changeName: function() {
            this.$store.dispatch('changeName', {
                name: 'jack'
            })
        }
    }
}
</script>
<style lang="less" scoped>

</style>